//泛型：类型也有参数
function login<T>(username:T):T{
    return username
}
let res=login("user")
console.log(res)

function yyy<A,B>(a:A,b:B):[A,B]{
    return [a,b]
}
let res1=yyy("lk","yyy")
console.log(res1)
function xxx<T extends String>(a:T):T{
    return a
}
let res2=xxx("sss")
console.log(res2)
type y1=keyof{name:"zs",age:18}
function y2<T extends y1>(a:T){
    return a
}
let res3=y2("name")
console.log(res3)
function y3<T extends {name:String,age:Number},K extends y1>(a:T,b:K){
    return a[b]
}
let res4=y3({name:"zs",age:23},"name")
console.log(res4)
let res5=y3({name:"zs",age:23},"age")
console.log(res5)
type win<T>={
    name:T
}
let a:win<string>={
    name:"zs"
}
console.log(a)
interface Result<T>{
    status:number,
    data:T
}
type ll={name:string,age:number}
let r1:Result<ll>={
    status:12,
    data:{
        name:"zs",
        age:12
    }
}
let r2:Result<"aa">={
    status:12,
    data:"aa"
}

